home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Other / GACUPS / Source / GACUPSListener.m < prev    next >
Encoding:
Text File  |  1994-05-04  |  2.7 KB  |  89 lines

  1. #import <appkit/appkit.h>
  2. #import "GACUPSListener.h"
  3. #import <mach/mach.h>
  4. #import <mach/message.h>
  5. #import <servers/netname.h>
  6. extern port_t name_server_port;
  7. extern id NXResponsibleDelegate();
  8. @implementation  GACUPSListener :Listener
  9. {}
  10. static NXRemoteMethod *remoteMethods = NULL;
  11. #define REMOTEMETHODS 1
  12. + initialize 
  13. /* */
  14. {
  15.     if (!remoteMethods) {
  16.     remoteMethods =
  17.     (NXRemoteMethod *) malloc((REMOTEMETHODS+1)*sizeof(NXRemoteMethod));
  18.     remoteMethods[0].key = 
  19.     @selector(systemMode:inverterStatus:alarmStatus:ACInputVolts:ACOutputVolts:ACOutputDeciAmperes:ACLoadVA:batteryDeciVolts:deciHertz:minutes:ambientTemp:ROMVersion:time:);
  20.     remoteMethods[0].types = "IIIIIIIIIIIII";
  21.     remoteMethods[REMOTEMETHODS].key = NULL;
  22.     }
  23.     return self;
  24. }
  25. -(int)systemMode : (int *) systemMode
  26.     inverterStatus : (int *) inverterStatus
  27.     alarmStatus : (int *) alarmStatus
  28.     ACInputVolts : (int *) ACInputVolts
  29.     ACOutputVolts : (int *) ACOutputVolts
  30.     ACOutputDeciAmperes : (int *) ACOutputDeciAmperes
  31.     ACLoadVA : (int *) ACLoadVA
  32.     batteryDeciVolts : (int *) batteryDeciVolts
  33.     deciHertz : (int *) deciHertz
  34.     minutes : (int *) minutes
  35.     ambientTemp : (int *) ambientTemp
  36.     ROMVersion : (int *) ROMVersion
  37.     time : (int *) time
  38. /* */
  39. {
  40.     id _NXd;
  41.     if (_NXd = NXResponsibleDelegate(self,
  42.     @selector(systemMode:inverterStatus:alarmStatus:ACInputVolts:ACOutputVolts:ACOutputDeciAmperes:ACLoadVA:batteryDeciVolts:deciHertz:minutes:ambientTemp:ROMVersion:time:)))
  43.     return [_NXd systemMode : systemMode
  44.         inverterStatus : inverterStatus
  45.         alarmStatus : alarmStatus
  46.         ACInputVolts : ACInputVolts
  47.         ACOutputVolts : ACOutputVolts
  48.         ACOutputDeciAmperes : ACOutputDeciAmperes
  49.         ACLoadVA : ACLoadVA
  50.         batteryDeciVolts : batteryDeciVolts
  51.         deciHertz : deciHertz
  52.         minutes : minutes
  53.         ambientTemp : ambientTemp
  54.         ROMVersion : ROMVersion
  55.         time : time];
  56.     return -1;
  57. }
  58.  
  59. - (int) performRemoteMethod : (NXRemoteMethod *) method
  60.                   paramList : (NXParamValue *) paramList {
  61. /* */
  62.     switch (method - remoteMethods) {
  63.     case 0:
  64.     return [self systemMode : ¶mList[0].ival
  65.         inverterStatus : ¶mList[1].ival
  66.         alarmStatus : ¶mList[2].ival
  67.         ACInputVolts : ¶mList[3].ival
  68.         ACOutputVolts : ¶mList[4].ival
  69.         ACOutputDeciAmperes : ¶mList[5].ival
  70.         ACLoadVA : ¶mList[6].ival
  71.         batteryDeciVolts : ¶mList[7].ival
  72.         deciHertz : ¶mList[8].ival
  73.         minutes : ¶mList[9].ival
  74.         ambientTemp : ¶mList[10].ival
  75.         ROMVersion : ¶mList[11].ival
  76.         time : ¶mList[12].ival];
  77.     default:
  78.     return [super performRemoteMethod : method paramList : paramList];
  79.     }
  80. }
  81. - (NXRemoteMethod *) remoteMethodFor: (SEL) aSel {
  82. /* */
  83.     NXRemoteMethod *rm;
  84.     if (rm = NXRemoteMethodFromSel(aSel,remoteMethods))
  85.         return rm;
  86.     return [super remoteMethodFor : aSel];
  87. }
  88. @end
  89.